{smcl}
{txt}{sf}{ul off}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}/Users/Didac/Dropbox/Shared/Replication Files/IO_Replication/Data_building_part_2_print.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}22 May 2019, 11:49:28
{txt}
{com}. 
. * Set the Path
. cd "/Users/Didac/Dropbox/Shared/Replication Files/IO_Replication/"
{res}/Users/Didac/Dropbox/Shared/Replication Files/IO_Replication
{txt}
{com}. 
. *********************************************************************
. * COMPUTER WAR IN ADJACENT COUNTRIES
. * Exclude war between i and -i. 
. *********************************************************************
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Albania_neighbor  = 1 if country == "Greece" | country == "Kosovo" | country == "Macedonia" | country == "Montenegro" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Albania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Albania"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Albania_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Albania"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Albania_neighbor
{txt}
{com}. save "_Albania_neighbors.dta", replace
{txt}file _Albania_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Argentina_neighbor  = 1 if country == "Bolivia" | country == "Brazil" | country == "Chile" | country == "Paraguay" | country == "Uruguay" 
{txt}(9,996 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Argentina"
{txt}(50 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Argentina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Argentina"
{txt}(1 real change made)

{com}. replace external_war = 0 if participants_inter4 == "Argentina"
{txt}(4 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Argentina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Argentina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Argentina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Argentina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Argentina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Argentina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Argentina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Argentina"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Argentina_neighbor == 1
{txt}(9996 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Argentina"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Argentina_neighbor
{txt}
{com}. save "_Argentina_neighbors.dta", replace
{txt}file _Argentina_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Armenia_neighbor  = 1 if country == "Azerbaijan" | country == "Georgia" | country == "Iran" | country == "Turkey" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Armenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Armenia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Armenia_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Armenia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Armenia_neighbor
{txt}
{com}. save "_Armenia_neighbors.dta", replace
{txt}file _Armenia_neighbors.dta saved

{com}. 
. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Australia_neighbor  = 1 if country == "New Zealand"
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Australia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Australia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Australia_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Australia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Australia_neighbor
{txt}
{com}. save "_Australia_neighbors.dta", replace
{txt}file _Australia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Austria_neighbor  = 1 if country == "Czech Republic" | country == "Germany" | country == "Hungary" | country == "Italy" | country == "Liechtenstein" | country == "Slovakia" | country == "Slovenia" | country == "Switzerland" 
{txt}(9,800 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Austria"
{txt}(11 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Austria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Austria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Austria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Austria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Austria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Austria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Austria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Austria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Austria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Austria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Austria"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Austria_neighbor == 1
{txt}(9800 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Austria"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Austria_neighbor
{txt}
{com}. save "_Austria_neighbors.dta", replace
{txt}file _Austria_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Azerbaijan_neighbor  = 1 if country == "Armenia" | country == "Georgia" | country == "Iran" | country == "Russia" | country == "Turkey" 
{txt}(9,996 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Azerbaijan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Azerbaijan"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Azerbaijan_neighbor == 1
{txt}(9996 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Azerbaijan"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Azerbaijan_neighbor
{txt}
{com}. save "_Azerbaijan_neighbors.dta", replace
{txt}file _Azerbaijan_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Bangladesh_neighbor  = 1 if country == "India" | country == "Myanmar" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Bangladesh"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Bangladesh"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Bangladesh_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Bangladesh"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Bangladesh_neighbor
{txt}
{com}. save "_Bangladesh_neighbors.dta", replace
{txt}file _Bangladesh_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Belarus_neighbor  = 1 if country == "Latvia" | country == "Lithuania" | country == "Poland" | country == "Russia" | country == "Ukraine" 
{txt}(9,996 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Belarus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Belarus"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Belarus_neighbor == 1
{txt}(9996 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Belarus"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Belarus_neighbor
{txt}
{com}. save "_Belarus_neighbors.dta", replace
{txt}file _Belarus_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Belgium_neighbor  = 1 if country == "France" | country == "Germany" | country == "Luxembourg" | country == "Netherlands" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Belgium"
{txt}(1 real change made)

{com}. replace external_war = 0 if participants_inter2 == "Belgium"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Belgium"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Belgium"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Belgium"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Belgium"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Belgium"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Belgium"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Belgium"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Belgium"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Belgium"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Belgium"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Belgium_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Belgium"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Belgium_neighbor
{txt}
{com}. save "_Belgium_neighbors.dta", replace
{txt}file _Belgium_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Bhutan_neighbor  = 1 if country == "China" | country == "India" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Bhutan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Bhutan"
{txt}(1 real change made)

{com}. replace external_war = 0 if participants_inter3 == "Bhutan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Bhutan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Bhutan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Bhutan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Bhutan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Bhutan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Bhutan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Bhutan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Bhutan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Bhutan"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Bhutan_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Bhutan"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Bhutan_neighbor
{txt}
{com}. save "_Bhutan_neighbors.dta", replace
{txt}file _Bhutan_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Bolivia_neighbor  = 1 if country == "Argentina" | country == "Brazil" | country == "Chile" | country == "Paraguay" | country == "Peru" 
{txt}(9,996 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Bolivia"
{txt}(23 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Bolivia"
{txt}(6 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Bolivia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Bolivia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Bolivia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Bolivia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Bolivia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Bolivia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Bolivia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Bolivia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Bolivia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Bolivia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Bolivia_neighbor == 1
{txt}(9996 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Bolivia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Bolivia_neighbor
{txt}
{com}. save "_Bolivia_neighbors.dta", replace
{txt}file _Bolivia_neighbors.dta saved

{com}. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Bosnia_and_Herzegovina_neighbor  = 1 if country == "Croatia" | country == "Montenegro" | country == "Serbia" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Bosnia and Herzegovina"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Bosnia_and_Herzegovina_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Bosnia and Herzegovina"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Bosnia_and_Herzegovina_neighbor
{txt}
{com}. save "_Bosnia_and_Herzegovina_neighbors.dta", replace
{txt}file _Bosnia_and_Herzegovina_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Brazil_neighbor  = 1 if country == "Argentina" | country == "Bolivia" | country == "Colombia" | country == "FrenchGuiana" | country == "Guyana" | country == "Paraguay" | country == "Peru" | country == "Suriname" | country == "Uruguay" | country == "Venezuela"
{txt}(9,800 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Brazil"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Brazil"
{txt}(51 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Brazil"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Brazil"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Brazil"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Brazil"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Brazil"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Brazil"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Brazil"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Brazil"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Brazil"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Brazil"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Brazil_neighbor == 1
{txt}(9800 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Brazil"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Brazil_neighbor
{txt}
{com}. sort year
{txt}
{com}. save "_Brazil_neighbors.dta", replace
{txt}file _Brazil_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Bulgaria_neighbor  = 1 if country == "Greece" | country == "Macedonia" | country == "Romania" | country == "Serbia" | country == "Turkey" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Bulgaria"
{txt}(6 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Bulgaria"
{txt}(1 real change made)

{com}. replace external_war = 0 if participants_inter3 == "Bulgaria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Bulgaria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Bulgaria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Bulgaria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Bulgaria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Bulgaria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Bulgaria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Bulgaria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Bulgaria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Bulgaria"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Bulgaria_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Bulgaria"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Bulgaria_neighbor
{txt}
{com}. save "_Bulgaria_neighbors.dta", replace
{txt}file _Bulgaria_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Burundi_neighbor  = 1 if country == "Democratic Republic of the Congo" | country == "Rwanda" | country == "Tanzania" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Burundi"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Burundi"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Burundi_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Burundi"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Burundi_neighbor
{txt}
{com}. save "_Burundi_neighbors.dta", replace
{txt}file _Burundi_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Cambodia_neighbor  = 1 if country == "Laos" | country == "Thailand" | country == "Vietnam" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Cambodia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Cambodia"
{txt}(8 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Cambodia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Cambodia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Cambodia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Cambodia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Cambodia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Cambodia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Cambodia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Cambodia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Cambodia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Cambodia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Cambodia_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Cambodia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Cambodia_neighbor
{txt}
{com}. save "_Cambodia_neighbors.dta", replace
{txt}file _Cambodia_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Canada_neighbor  = 1 if country == "United States of America" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Canada"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Canada"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Canada_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Canada"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Canada_neighbor
{txt}
{com}. save "_Canada_neighbors.dta", replace
{txt}file _Canada_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Chad_neighbor  = 1 if country == "Cameroon" | country == "Central African Republic" | country == "Libya" | country == "Niger" | country == "Nigeria" | country == "Sudan" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Chad"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Chad"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Chad_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Chad"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Chad_neighbor
{txt}
{com}. save "_Chad_neighbors.dta", replace
{txt}file _Chad_neighbors.dta saved

{com}. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Chile_neighbor  = 1 if country == "Argentina" | country == "Bolivia" | country == "Peru" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Chile"
{txt}(6 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Chile"
{txt}(15 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Chile"
{txt}(4 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Chile"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Chile"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Chile"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Chile"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Chile"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Chile"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Chile"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Chile"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Chile"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Chile_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Chile"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Chile_neighbor
{txt}
{com}. save "_Chile_neighbors.dta", replace
{txt}file _Chile_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     China_neighbor  = 1 if country == "Afghanistan" | country == "Bhutan" | country == "Hong Kong" | country == "India" | country == "Kazakhstan" | country == "Kyrgyzstan" | country == "Laos" | country == "Macau" | country == "Mongolia" | country == "Myanmar" | country == "Nepal" |          country == "North Korea" |      country == "Pakistan" |         country == "Russia" |   country == "Tajikistan" |       country == "Vietnam"  
{txt}(9,506 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "China"
{txt}(9 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "China"
{txt}(8 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "China"
{txt}(53 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "China"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "China"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "China"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "China"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "China"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "China"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "China"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "China"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="China"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if China_neighbor == 1
{txt}(9506 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "China"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* China_neighbor
{txt}
{com}. save "_China_neighbors.dta", replace
{txt}file _China_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Colombia_neighbor  = 1 if country == "Brazil" | country == "Ecuador" | country == "Panama" | country == "Peru" | country == "Venezuela" 
{txt}(9,996 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Colombia"
{txt}(2 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Colombia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Colombia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Colombia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Colombia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Colombia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Colombia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Colombia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Colombia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Colombia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Colombia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Colombia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Colombia_neighbor == 1
{txt}(9996 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Colombia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Colombia_neighbor
{txt}
{com}. save "_Colombia_neighbors.dta", replace
{txt}file _Colombia_neighbors.dta saved

{com}. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Congo_neighbor  = 1 if country == "Angola" | country == "Cameroon" | country == "Central African Republic" | country == "Democratic Republic of the Congo" | country == "Gabon" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Congo"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Congo_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Congo"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Congo_neighbor
{txt}
{com}. save "_Congo_neighbors.dta", replace
{txt}file _Congo_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Costa_Rica_neighbor  = 1 if country == "Nicaragua" | country == "Panama" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Costa Rica"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Costa Rica"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Costa_Rica_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Costa Rica"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Costa_Rica_neighbor
{txt}
{com}. save "_Costa_Rica_neighbors.dta", replace
{txt}file _Costa_Rica_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Croatia_neighbor  = 1 if country == "Bosnia and Herzegovina" | country == "Hungary" | country == "Montenegro" | country == "Serbia" | country == "Slovenia" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Croatia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Croatia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Croatia_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Croatia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Croatia_neighbor
{txt}
{com}. save "_Croatia_neighbors.dta", replace
{txt}file _Croatia_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Cyprus_neighbor  = 1 if country == "Turkey" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Cyprus"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Cyprus"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Cyprus_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Cyprus"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Cyprus_neighbor
{txt}
{com}. save "_Cyprus_neighbors.dta", replace
{txt}file _Cyprus_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Czech_Republic_neighbor  = 1 if country == "Austria" | country == "Germany" | country == "Poland" | country == "Slovakia" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Czech Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Czech Republic"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Czech_Republic_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Czech Republic"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Czech_Republic_neighbor
{txt}
{com}. save "_Czech_Republic_neighbors.dta", replace
{txt}file _Czech_Republic_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     DR_Congo_neighbor  = 1 if country == "Angola" | country == "Burundi" | country == "Central African Republic" | country == "Congo" | country == "Rwanda" | country == "South Sudan" | country == "Tanzania" | country == "Uganda" | country == "Zambia" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Democratic Republic of the Congo"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if DR_Congo_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Democratic Republic of the Congo"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* DR_Congo_neighbor
{txt}
{com}. save "_Democratic_Republic_Congo_neighbors.dta", replace
{txt}file _Democratic_Republic_Congo_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Denmark_neighbor  = 1 if country == "Germany" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Denmark"
{txt}(4 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Denmark"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Denmark"
{txt}(4 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Denmark"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Denmark"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Denmark"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Denmark"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Denmark"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Denmark"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Denmark"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Denmark"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Denmark"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Denmark_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Denmark"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Denmark_neighbor
{txt}
{com}. save "_Denmark_neighbors.dta", replace
{txt}file _Denmark_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Dominican_Republic_neighbor  = 1 if country == "Haiti" 
{txt}(10,486 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Dominican Republic"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Dominican Republic"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Dominican_Republic_neighbor == 1
{txt}(10486 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}(10486 missing values generated)

{com}. keep if country == "Dominican Republic"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Dominican_Republic_neighbor
{txt}
{com}. save "_Dominican_Republic_neighbors.dta", replace
{txt}file _Dominican_Republic_neighbors.dta saved

{com}. 
. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Ecuador_neighbor  = 1 if country == "Colombia" | country == "Peru" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Ecuador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Ecuador"
{txt}(2 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Ecuador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Ecuador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Ecuador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Ecuador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Ecuador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Ecuador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Ecuador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Ecuador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Ecuador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Ecuador"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Ecuador_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Ecuador"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Ecuador_neighbor
{txt}
{com}. save "_Ecuador_neighbors.dta", replace
{txt}file _Ecuador_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Egypt_neighbor  = 1 if country == "Gaza Strip" | country == "Israel" | country == "Libya" | country == "Sudan" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Egypt"
{txt}(10 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Egypt"
{txt}(4 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Egypt"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Egypt"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Egypt"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Egypt"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Egypt"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Egypt"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Egypt"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Egypt"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Egypt"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Egypt"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Egypt_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Egypt"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Egypt_neighbor
{txt}
{com}. save "_Egypt_neighbors.dta", replace
{txt}file _Egypt_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     El_Salvador_neighbor  = 1 if country == "Guatemala" | country == "Honduras" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "El Salvador"
{txt}(10 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "El Salvador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "El Salvador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "El Salvador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "El Salvador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "El Salvador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "El Salvador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "El Salvador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "El Salvador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "El Salvador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "El Salvador"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="El Salvador"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if El_Salvador_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "El Salvador"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* El_Salvador_neighbor
{txt}
{com}. save "_El_Salvador_neighbors.dta", replace
{txt}file _El_Salvador_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Estonia_neighbor  = 1 if country == "Latvia" | country == "Russia" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Estonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Estonia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Estonia_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Estonia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Estonia_neighbor
{txt}
{com}. save "_Estonia_neighbors.dta", replace
{txt}file _Estonia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Ethiopia_neighbor  = 1 if country == "Djibouti" | country == "Eritrea" | country == "Kenya" | country == "Somalia" | country == "South Sudan" | country == "Sudan" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Ethiopia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Ethiopia"
{txt}(13 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Ethiopia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Ethiopia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Ethiopia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Ethiopia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Ethiopia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Ethiopia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Ethiopia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Ethiopia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Ethiopia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Ethiopia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Ethiopia_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Ethiopia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Ethiopia_neighbor
{txt}
{com}. save "_Ethiopia_neighbors.dta", replace
{txt}file _Ethiopia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Finland_neighbor  = 1 if country == "Norway" | country == "Russia" | country == "Sweden" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Finland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Finland"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Finland_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Finland"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Finland_neighbor
{txt}
{com}. save "_Finland_neighbors.dta", replace
{txt}file _Finland_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     France_neighbor  = 1 if country == "Andorra" | country == "Belgium" | country == "Germany" | country == "Italy" | country == "Luxembourg" | country == "Monaco" | country == "Spain" | country == "Switzerland" 
{txt}(9,996 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "France"
{txt}(132 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "France"
{txt}(5 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "France"
{txt}(36 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "France"
{txt}(1 real change made)

{com}. replace external_war = 0 if participants_inter5 == "France"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "France"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "France"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "France"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "France"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "France"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "France"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="France"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if France_neighbor == 1
{txt}(9996 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "France"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* France_neighbor
{txt}
{com}. save "_France_neighbors.dta", replace
{txt}file _France_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Georgia_neighbor  = 1 if country == "Armenia" | country == "Azerbaijan" | country == "Russia" | country == "Turkey" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Georgia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Georgia"
{txt}(20 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Georgia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Georgia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Georgia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Georgia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Georgia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Georgia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Georgia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Georgia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Georgia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Georgia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Georgia_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Georgia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Georgia_neighbor
{txt}
{com}. save "_Georgia_neighbors.dta", replace
{txt}file _Georgia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Germany_neighbor  = 1 if country == "Austria" | country == "Belgium" | country == "Czech Republic" | country == "Denmark" | country == "France" | country == "Luxembourg" | country == "Netherlands" | country == "Poland" | country == "Switzerland" 
{txt}(9,702 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Germany"
{txt}(6 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Germany"
{txt}(4 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Germany"
{txt}(4 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Germany"
{txt}(4 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Germany"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Germany"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Germany"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Germany"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Germany"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Germany"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Germany"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Germany"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Germany_neighbor == 1
{txt}(9702 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Germany"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Germany_neighbor
{txt}
{com}. save "_Germany_neighbors.dta", replace
{txt}file _Germany_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Greece_neighbor  = 1 if country == "Albania" | country == "Bulgaria" | country == "Macedonia" | country == "Turkey" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Greece"
{txt}(2 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Greece"
{txt}(6 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Greece"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Greece"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Greece"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Greece"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Greece"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Greece"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Greece"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Greece"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Greece"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Greece"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Greece_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Greece"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Greece_neighbor
{txt}
{com}. save "_Greece_neighbors.dta", replace
{txt}file _Greece_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Guatemala_neighbor  = 1 if country == "Belize" | country == "El Salvador" | country == "Honduras" | country == "Mexico" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Guatemala"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Guatemala"
{txt}(7 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Guatemala"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Guatemala"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Guatemala"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Guatemala"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Guatemala"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Guatemala"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Guatemala"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Guatemala"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Guatemala"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Guatemala"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Guatemala_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Guatemala"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Guatemala_neighbor
{txt}
{com}. save "_Guatemala_neighbors.dta", replace
{txt}file _Guatemala_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Guinea_neighbor  = 1 if country == "Guinea-Bissau" | country == "Ivory Coast" | country == "Liberia" | country == "Mali" | country == "Senegal" | country == "Sierra Leone" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Guinea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Guinea"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Guinea_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Guinea"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Guinea_neighbor
{txt}
{com}. save "_Guinea_neighbors.dta", replace
{txt}file _Guinea_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Honduras_neighbor  = 1 if country == "El Salvador" | country == "Guatemala" | country == "Nicaragua" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Honduras"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Honduras"
{txt}(3 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Honduras"
{txt}(3 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Honduras"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Honduras"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Honduras"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Honduras"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Honduras"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Honduras"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Honduras"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Honduras"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Honduras"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Honduras_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Honduras"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Honduras_neighbor
{txt}
{com}. save "_Honduras_neighbors.dta", replace
{txt}file _Honduras_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Hungary_neighbor  = 1 if country == "Austria" | country == "Croatia" | country == "Romania" | country == "Serbia" | country == "Slovakia" | country == "Slovenia" | country == "Ukraine" 
{txt}(9,898 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Hungary"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Hungary"
{txt}(11 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Hungary"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Hungary"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Hungary"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Hungary"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Hungary"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Hungary"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Hungary"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Hungary"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Hungary"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Hungary"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Hungary_neighbor == 1
{txt}(9898 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Hungary"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Hungary_neighbor
{txt}
{com}. save "_Hungary_neighbors.dta", replace
{txt}file _Hungary_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     India_neighbor  = 1 if country == "Bangladesh" | country == "Bhutan" | country == "China" | country == "Myanmar" | country == "Nepal" | country == "Pakistan" 
{txt}(9,898 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "India"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="India"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if India_neighbor == 1
{txt}(9898 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "India"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* India_neighbor
{txt}
{com}. save "_India_neighbors.dta", replace
{txt}file _India_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Indonesia_neighbor  = 1 if country == "East_Timor" | country == "Malaysia" | country == "Papua New Guinea" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Indonesia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Indonesia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Indonesia_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Indonesia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Indonesia_neighbor
{txt}
{com}. save "_Indonesia_neighbors.dta", replace
{txt}file _Indonesia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Iran_neighbor  = 1 if country == "Afghanistan" | country == "Armenia" | country == "Azerbaijan" | country == "Iraq" | country == "Pakistan" | country == "Turkey" | country == "Turkmenistan" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Iran"
{txt}(3 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Iran"
{txt}(12 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Iran"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Iran"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Iran"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Iran"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Iran"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Iran"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Iran"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Iran"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Iran"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Iran"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Iran_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Iran"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Iran_neighbor
{txt}
{com}. save "_Iran_neighbors.dta", replace
{txt}file _Iran_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Ireland_neighbor  = 1 if country == "United_Kingdom" 
{txt}(10,486 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Ireland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Ireland"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Ireland_neighbor == 1
{txt}(10486 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}(10486 missing values generated)

{com}. keep if country == "Ireland"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Ireland_neighbor
{txt}
{com}. save "_Ireland_neighbors.dta", replace
{txt}file _Ireland_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Israel_neighbor  = 1 if country == "Egypt" | country == "Gaza Strip" | country == "Jordan" | country == "Lebanon" | country == "Syria" | country == "West Bank" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Israel"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Israel"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Israel_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Israel"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Israel_neighbor
{txt}
{com}. save "_Israel_neighbors.dta", replace
{txt}file _Israel_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Italy_neighbor  = 1 if country == "Austria" | country == "France" | country == "San Marino" | country == "Slovenia" | country == "Switzerland" | country == "Vatican City" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Italy"
{txt}(12 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Italy"
{txt}(18 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Italy"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Italy"
{txt}(3 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Italy"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Italy"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Italy"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Italy"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Italy"
{txt}(4 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Italy"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Italy"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Italy"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Italy_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Italy"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Italy_neighbor
{txt}
{com}. save "_Italy_neighbors.dta", replace
{txt}file _Italy_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Ivory_Coast_neighbor  = 1 if country == "Burkina Faso" | country == "Ghana" | country == "Guinea" | country == "Liberia" | country == "Mali" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Ivory Coast"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Ivory Coast"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Ivory_Coast_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Ivory Coast"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Ivory_Coast_neighbor
{txt}
{com}. save "_Ivory_Coast_neighbors.dta", replace
{txt}file _Ivory_Coast_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Kazakhstan_neighbor  = 1 if country == "China" | country == "Kyrgyzstan" | country == "Russia" | country == "Turkmenistan" | country == "Uzbekistan" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Kazakhstan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Kazakhstan"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Kazakhstan_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Kazakhstan"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Kazakhstan_neighbor
{txt}
{com}. save "_Kazakhstan_neighbors.dta", replace
{txt}file _Kazakhstan_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Kenya_neighbor  = 1 if country == "Ethiopia" | country == "Somalia" | country == "South Sudan" | country == "Tanzania" | country == "Uganda" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Kenya"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Kenya"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Kenya_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Kenya"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Kenya_neighbor
{txt}
{com}. save "_Kenya_neighbors.dta", replace
{txt}file _Kenya_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Latvia_neighbor  = 1 if country == "Belarus" | country == "Estonia" | country == "Lithuania" | country == "Russia" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Latvia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Latvia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Latvia_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Latvia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Latvia_neighbor
{txt}
{com}. save "_Latvia_neighbors.dta", replace
{txt}file _Latvia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Lebanon_neighbor  = 1 if country == "Israel" | country == "Syria" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Lebanon"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Lebanon"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Lebanon_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Lebanon"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Lebanon_neighbor
{txt}
{com}. save "_Lebanon_neighbors.dta", replace
{txt}file _Lebanon_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Lesotho_neighbor  = 1 if country == "South Africa" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Lesotho"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Lesotho"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Lesotho_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Lesotho"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Lesotho_neighbor
{txt}
{com}. save "_Lesotho_neighbors.dta", replace
{txt}file _Lesotho_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Lithuania_neighbor  = 1 if country == "Belarus" | country == "Latvia" | country == "Poland" | country == "Russia" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Lithuania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Lithuania"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Lithuania_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Lithuania"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Lithuania_neighbor
{txt}
{com}. save "_Lithuania_neighbors.dta", replace
{txt}file _Lithuania_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Macedonia_neighbor  = 1 if country == "Albania" | country == "Bulgaria" | country == "Greece" | country == "Kosovo" | country == "Serbia" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Macedonia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Macedonia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Macedonia_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Macedonia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Macedonia_neighbor
{txt}
{com}. save "_Macedonia_neighbors.dta", replace
{txt}file _Macedonia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Malaysia_neighbor  = 1 if country == "Brunei" | country == "Indonesia" | country == "Thailand" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Malaysia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Malaysia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Malaysia_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Malaysia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Malaysia_neighbor
{txt}
{com}. save "_Malaysia_neighbors.dta", replace
{txt}file _Malaysia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Mali_neighbor  = 1 if country == "Mali" | country == "Burkina Faso" | country == "Guinea" | country == "Ivory Coast" | country == "Mauritania" | country == "Niger" | country == "Senegal" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Argentina"
{txt}(50 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Mali"
{txt}(1 real change made)

{com}. replace external_war = 0 if participants_inter3 == "Mali"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Mali"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Mali"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Mali"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Mali"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Mali"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Mali"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Mali"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Mali"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Mali"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Mali_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Mali"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Mali_neighbor
{txt}
{com}. save "_Mali_neighbors.dta", replace
{txt}file _Mali_neighbors.dta saved

{com}. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Mexico_neighbor  = 1 if country == "Belize" | country == "Guatemala" | country == "United States of America" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Mexico"
{txt}(6 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Mexico"
{txt}(12 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Mexico"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Mexico"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Mexico"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Mexico"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Mexico"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Mexico"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Mexico"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Mexico"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Mexico"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Mexico"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Mexico_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Mexico"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Mexico_neighbor
{txt}
{com}. save "_Mexico_neighbors.dta", replace
{txt}file _Mexico_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Moldova_neighbor  = 1 if country == "Romania" | country == "Ukraine" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Moldova"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Moldova"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Moldova_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Moldova"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Moldova_neighbor
{txt}
{com}. save "_Moldova_neighbors.dta", replace
{txt}file _Moldova_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Mongolia_neighbor  = 1 if country == "China" | country == "Russia" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Mongolia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Mongolia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Mongolia_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Mongolia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Mongolia_neighbor
{txt}
{com}. save "_Mongolia_neighbors.dta", replace
{txt}file _Mongolia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Morocco_neighbor  = 1 if country == "Morocco" | country == "Spain" | country == "Western Sahara" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Morocco"
{txt}(8 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Morocco"
{txt}(1 real change made)

{com}. replace external_war = 0 if participants_inter3 == "Morocco"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Morocco"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Morocco"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Morocco"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Morocco"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Morocco"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Morocco"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Morocco"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Morocco"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Morocco"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Morocco_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Morocco"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Morocco_neighbor
{txt}
{com}. save "_Morocco_neighbors.dta", replace
{txt}file _Morocco_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Myanmar_neighbor  = 1 if country == "Bangladesh" | country == "China" | country == "India" | country == "Laos" | country == "Thailand" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Myanmar"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Myanmar"
{txt}(12 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Myanmar"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Myanmar"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Myanmar"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Myanmar"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Myanmar"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Myanmar"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Myanmar"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Myanmar"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Myanmar"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Myanmar"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Myanmar_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Myanmar"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Myanmar_neighbor
{txt}
{com}. save "_Myanmar_neighbors.dta", replace
{txt}file _Myanmar_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Namibia_neighbor  = 1 if country == "Angola" | country == "Botswana" | country == "South Africa" | country == "Zambia" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Namibia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Namibia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Namibia_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Namibia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Namibia_neighbor
{txt}
{com}. save "_Namibia_neighbors.dta", replace
{txt}file _Namibia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Nepal_neighbor  = 1 if country == "China" | country == "India" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Nepal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Nepal"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Nepal_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Nepal"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Nepal_neighbor
{txt}
{com}. save "_Nepal_neighbors.dta", replace
{txt}file _Nepal_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Netherlands_neighbor  = 1 if country == "Belgium" | country == "Germany" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Netherlands"
{txt}(7 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Netherlands"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Netherlands"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Netherlands"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Netherlands"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Netherlands"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Netherlands"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Netherlands"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Netherlands"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Netherlands"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Netherlands"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Netherlands"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Netherlands_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Netherlands"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Netherlands_neighbor
{txt}
{com}. save "_Netherlands_neighbors.dta", replace
{txt}file _Netherlands_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Nicaragua_neighbor  = 1 if country == "Costa Rica" | country == "Honduras" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Nicaragua"
{txt}(2 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Nicaragua"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Nicaragua"
{txt}(3 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Nicaragua"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Nicaragua"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Nicaragua"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Nicaragua"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Nicaragua"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Nicaragua"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Nicaragua"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Nicaragua"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Nicaragua"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Nicaragua_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Nicaragua"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Nicaragua_neighbor
{txt}
{com}. save "_Nicaragua_neighbors.dta", replace
{txt}file _Nicaragua_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Nigeria_neighbor  = 1 if country == "Benin" | country == "Cameroon" | country == "Chad" | country == "Niger" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Nigeria"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Nigeria"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Nigeria_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Nigeria"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Nigeria_neighbor
{txt}
{com}. save "_Nigeria_neighbors.dta", replace
{txt}file _Nigeria_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Norway_neighbor  = 1 if country == "Finland" | country == "Russia" | country == "Sweden" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Norway"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Norway"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Norway_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Norway"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Norway_neighbor
{txt}
{com}. save "_Norway_neighbors.dta", replace
{txt}file _Norway_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Pakistan_neighbor  = 1 if country == "Afghanistan" | country == "China" | country == "India" | country == "Iran" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Pakistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Pakistan"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Pakistan_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Pakistan"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Pakistan_neighbor
{txt}
{com}. save "_Pakistan_neighbors.dta", replace
{txt}file _Pakistan_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Panama_neighbor  = 1 if country == "Colombia" | country == "Costa Rica" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Panama"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Panama"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Panama_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Panama"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Panama_neighbor
{txt}
{com}. save "_Panama_neighbors.dta", replace
{txt}file _Panama_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Paraguay_neighbor  = 1 if country == "Argentina" | country == "Bolivia" | country == "Brazil" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Paraguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Paraguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Paraguay"
{txt}(21 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Paraguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Paraguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Paraguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Paraguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Paraguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Paraguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Paraguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Paraguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Paraguay"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Paraguay_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Paraguay"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Paraguay_neighbor
{txt}
{com}. save "_Paraguay_neighbors.dta", replace
{txt}file _Paraguay_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Peru_neighbor  = 1 if country == "Bolivia" | country == "Brazil" | country == "Chile" | country == "Colombia" | country == "Ecuador" 
{txt}(9,996 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Peru"
{txt}(6 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Peru"
{txt}(14 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Peru"
{txt}(15 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Peru"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Peru"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Peru"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Peru"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Peru"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Peru"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Peru"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Peru"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Peru"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Peru_neighbor == 1
{txt}(9996 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Peru"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Peru_neighbor
{txt}
{com}. save "_Peru_neighbors.dta", replace
{txt}file _Peru_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Poland_neighbor  = 1 if country == "Belarus" | country == "Czech Republic" | country == "Germany" | country == "Lithuania" | country == "Russia" | country == "Slovakia" | country == "Ukraine" 
{txt}(9,800 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Poland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Poland"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Poland_neighbor == 1
{txt}(9800 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Poland"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Poland_neighbor
{txt}
{com}. save "_Poland_neighbors.dta", replace
{txt}file _Poland_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Portugal_neighbor  = 1 if country == "Spain" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Portugal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Portugal"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Portugal_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Portugal"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Portugal_neighbor
{txt}
{com}. save "_Portugal_neighbors.dta", replace
{txt}file _Portugal_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Romania_neighbor  = 1 if country == "Bulgaria" | country == "Hungary" | country == "Moldova" | country == "Serbia" | country == "Ukraine" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Romania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Romania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Romania"
{txt}(1 real change made)

{com}. replace external_war = 0 if participants_inter4 == "Romania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Romania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Romania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Romania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Romania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Romania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Romania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Romania"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Romania"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Romania_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Romania"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Romania_neighbor
{txt}
{com}. save "_Romania_neighbors.dta", replace
{txt}file _Romania_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Russia_neighbor  = 1 if country == "Azerbaijan" | country == "Belarus" | country == "China" | country == "Estonia" | country == "Finland" | country == "Georgia" | country == "Kazakhstan" | country == "Latvia" | country == "Lithuania" | country == "Mongolia" | country == "North Korea"    | country == "Norway"   | country == "Poland"   | country == "Ukraine"          
{txt}(9,212 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Russia"
{txt}(51 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Russia"
{txt}(4 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Russia"
{txt}(18 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Russia"
{txt}(5 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Russia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Russia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Russia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Russia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Russia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Russia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Russia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Russia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Russia_neighbor == 1
{txt}(9212 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Russia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Russia_neighbor
{txt}
{com}. save "_Russia_neighbors.dta", replace
{txt}file _Russia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Rwanda_neighbor  = 1 if country == "Burundi" | country == "Democratic Republic of the Congo" | country == "Tanzania" | country == "Uganda" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Rwanda"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Rwanda"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Rwanda_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Rwanda"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Rwanda_neighbor
{txt}
{com}. save "_Rwanda_neighbors.dta", replace
{txt}file _Rwanda_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Senegal_neighbor  = 1 if country == "Gambia" | country == "Guinea" | country == "Guinea-Bissau" | country == "Mali" | country == "Mauritania" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Senegal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Senegal"
{txt}(2 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Senegal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Senegal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Senegal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Senegal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Senegal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Senegal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Senegal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Senegal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Senegal"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Senegal"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Senegal_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Senegal"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Senegal_neighbor
{txt}
{com}. save "_Senegal_neighbors.dta", replace
{txt}file _Senegal_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Slovakia_neighbor  = 1 if country == "Austria" | country == "Czech Republic" | country == "Hungary" | country == "Poland" | country == "Ukraine" 
{txt}(9,996 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Slovakia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Slovakia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Slovakia_neighbor == 1
{txt}(9996 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Slovakia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Slovakia_neighbor
{txt}
{com}. save "_Slovakia_neighbors.dta", replace
{txt}file _Slovakia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Slovenia_neighbor  = 1 if country == "Austria" | country == "Croatia" | country == "Hungary" | country == "Italy" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Slovenia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Slovenia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Slovenia_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Slovenia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Slovenia_neighbor
{txt}
{com}. save "_Slovenia_neighbors.dta", replace
{txt}file _Slovenia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     South_Africa_neighbor  = 1 if country == "Botswana" | country == "Lesotho" | country == "Mozambique" | country == "Namibia" | country == "Swaziland" | country == "Zimbabwe" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "South Africa"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "South Africa"
{txt}(7 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "South Africa"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "South Africa"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "South Africa"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "South Africa"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "South Africa"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "South Africa"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "South Africa"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "South Africa"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "South Africa"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="South Africa"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if South_Africa_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "South Africa"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* South_Africa_neighbor
{txt}
{com}. save "_South_Africa_neighbors.dta", replace
{txt}file _South_Africa_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     South_Korea_neighbor  = 1 if country == "North Korea" 
{txt}(10,486 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "South Korea"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="South Korea"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if South_Korea_neighbor == 1
{txt}(10486 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}(10486 missing values generated)

{com}. keep if country == "South Korea"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* South_Korea_neighbor
{txt}
{com}. save "_South_Korea_neighbors.dta", replace
{txt}file _South_Korea_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Spain_neighbor  = 1 if country == "Andorra" | country == "France" | country == "Gibraltar" | country == "Morocco" | country == "Portugal" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Spain"
{txt}(2 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Spain"
{txt}(14 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Spain"
{txt}(6 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Spain"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Spain"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Spain"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Spain"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Spain"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Spain"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Spain"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Spain"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Spain"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Spain_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Spain"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Spain_neighbor
{txt}
{com}. save "_Spain_neighbors.dta", replace
{txt}file _Spain_neighbors.dta saved

{com}. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Sweden_neighbor  = 1 if country == "Finland" | country == "Norway" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Sweden"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Sweden"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Sweden_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Sweden"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Sweden_neighbor
{txt}
{com}. save "_Sweden_neighbors.dta", replace
{txt}file _Sweden_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Switzerland_neighbor  = 1 if country == "Austria" | country == "France" | country == "Germany" | country == "Italy" | country == "Liechtenstein" 
{txt}(10,094 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Switzerland"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Switzerland"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Switzerland_neighbor == 1
{txt}(10094 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Switzerland"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Switzerland_neighbor
{txt}
{com}. save "_Switzerland_neighbors.dta", replace
{txt}file _Switzerland_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Tajikistan_neighbor  = 1 if country == "Afghanistan" | country == "China" | country == "Kyrgyzstan" | country == "Uzbekistan" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Tajikistan"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Tajikistan"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Tajikistan_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Tajikistan"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Tajikistan_neighbor
{txt}
{com}. save "_Tajikistan_neighbors.dta", replace
{txt}file _Tajikistan_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Thailand_neighbor  = 1 if country == "Cambodia" | country == "Laos" | country == "Malaysia" | country == "Myanmar" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Thailand"
{txt}(18 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Thailand"
{txt}(2 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Thailand"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Thailand"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Thailand"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Thailand"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Thailand"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Thailand"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Thailand"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Thailand"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Thailand"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Thailand"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Thailand_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Thailand"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Thailand_neighbor
{txt}
{com}. save "_Thailand_neighbors.dta", replace
{txt}file _Thailand_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Tunisia_neighbor  = 1 if country == "Tunisia" | country == "Libya" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Tunisia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Tunisia"
{txt}(2 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Tunisia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Tunisia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Tunisia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Tunisia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Tunisia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Tunisia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Tunisia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Tunisia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Tunisia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Tunisia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Tunisia_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Tunisia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Tunisia_neighbor
{txt}
{com}. save "_Tunisia_neighbors.dta", replace
{txt}file _Tunisia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Turkey_neighbor  = 1 if country == "Armenia" | country == "Azerbaijan" | country == "Bulgaria" | country == "Georgia" | country == "Greece" | country == "Iran" | country == "Iraq" | country == "Syria" 
{txt}(9,898 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Turkey"
{txt}(12 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Turkey"
{txt}(11 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Turkey"
{txt}(5 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Turkey"
{txt}(19 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Turkey"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Turkey"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Turkey"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Turkey"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Turkey"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Turkey"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Turkey"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Turkey"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Turkey_neighbor == 1
{txt}(9898 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Turkey"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Turkey_neighbor
{txt}
{com}. save "_Turkey_neighbors.dta", replace
{txt}file _Turkey_neighbors.dta saved

{com}. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Ukraine_neighbor  = 1 if country == "Belarus" | country == "Hungary" | country == "Moldova" | country == "Poland" | country == "Romania" | country == "Russia" | country == "Slovakia" 
{txt}(9,800 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Ukraine"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Ukraine"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Ukraine_neighbor == 1
{txt}(9800 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Ukraine"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Ukraine_neighbor
{txt}
{com}. save "_Ukraine_neighbors.dta", replace
{txt}file _Ukraine_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     United_Kingdom_neighbor  = 1 if country == "Ireland" 
{txt}(10,388 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "United Kingdom"
{txt}(59 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "United Kingdom"
{txt}(28 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "United Kingdom"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "United Kingdom"
{txt}(29 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "United Kingdom"
{txt}(23 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "United Kingdom"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "United Kingdom"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "United Kingdom"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "United Kingdom"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "United Kingdom"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "United Kingdom"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="United Kingdom"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if United_Kingdom_neighbor == 1
{txt}(10388 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "United Kingdom"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* United_Kingdom_neighbor
{txt}
{com}. save "_United_Kingdom_neighbors.dta", replace
{txt}file _United_Kingdom_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     USA_neighbor  = 1 if country == "Canada" | country == "Mexico" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "United States of America"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "United States of America"
{txt}(8 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "United States of America"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "United States of America"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "United States of America"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "United States of America"
{txt}(5 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "United States of America"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "United States of America"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "United States of America"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "United States of America"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "United States of America"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="United States of America"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if USA_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "United States of America"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* USA_neighbor
{txt}
{com}. save "_United_States_of_America_neighbors.dta", replace
{txt}file _United_States_of_America_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Uruguay_neighbor  = 1 if country == "Argentina" | country == "Brazil" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Uruguay"
{txt}(1 real change made)

{com}. replace external_war = 0 if participants_inter2 == "Uruguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Uruguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Uruguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Uruguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Uruguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Uruguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Uruguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Uruguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Uruguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Uruguay"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Uruguay"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Uruguay_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Uruguay"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Uruguay_neighbor
{txt}
{com}. save "_Uruguay_neighbors.dta", replace
{txt}file _Uruguay_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Venezuela_neighbor  = 1 if country == "Brazil" | country == "Colombia" | country == "Guyana" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Venezuela"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Venezuela"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Venezuela_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Venezuela"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Venezuela_neighbor
{txt}
{com}. save "_Venezuela_neighbors.dta", replace
{txt}file _Venezuela_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Vietnam_neighbor  = 1 if country == "Cambodia" | country == "China" | country == "Laos" 
{txt}(10,290 missing values generated)

{com}. bysort year: egen tool = total(external_war) if Vietnam_neighbor == 1
{txt}(10290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Vietnam"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Vietnam"
{txt}(55 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Vietnam"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Vietnam"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Vietnam"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Vietnam"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Vietnam"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Vietnam"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Vietnam"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Vietnam"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Vietnam"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Vietnam"
{txt}(0 real changes made)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Vietnam"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Vietnam_neighbor
{txt}
{com}. save "_Vietnam_neighbors.dta", replace
{txt}file _Vietnam_neighbors.dta saved

{com}. 
. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Yemen_neighbor  = 1 if country == "Oman" | country == "Saudi Arabia" 
{txt}(10,486 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Yemen"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Yemen"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Yemen_neighbor == 1
{txt}(10486 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}(10486 missing values generated)

{com}. keep if country == "Yemen"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Yemen_neighbor
{txt}
{com}. save "_Yemen_neighbors.dta", replace
{txt}file _Yemen_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Zambia_neighbor  = 1 if country == "Angola" | country == "Botswana" | country == "Democratic Republic of the Congo" | country == "Malawi" | country == "Mozambique" | country == "Namibia" | country == "Tanzania" | country == "Zimbabwe" 
{txt}(10,192 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Zambia"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Zambia"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Zambia_neighbor == 1
{txt}(10192 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Zambia"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Zambia_neighbor
{txt}
{com}. save "_Zambia_neighbors.dta", replace
{txt}file _Zambia_neighbors.dta saved

{com}. 
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. gen     Zimbabwe_neighbor  = 1 if country == "Botswana" | country == "Mozambique" | country == "South Africa" | country == "Zambia" 
{txt}(10,290 missing values generated)

{com}. replace external_war = 0 if participants_inter1 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter2 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter3 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter4 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter5 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter6 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter7 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter8 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter9 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter10 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter11 == "Zimbabwe"
{txt}(0 real changes made)

{com}. replace external_war = 0 if participants_inter12 =="Zimbabwe"
{txt}(0 real changes made)

{com}. bysort year: egen tool = total(external_war) if Zimbabwe_neighbor == 1
{txt}(10290 missing values generated)

{com}. bysort year: egen n_neighbors_at_war = max(tool)
{txt}
{com}. keep if country == "Zimbabwe"
{txt}(10,388 observations deleted)

{com}. drop tool external_war participant* Zimbabwe_neighbor
{txt}
{com}. save "_Zimbabwe_neighbors.dta", replace
{txt}file _Zimbabwe_neighbors.dta saved

{com}.                                                 
.                                                 
. *** Merge all country_neighbor files                                                                                                    
. append using _Albania_neighbors.dta
{txt}
{com}. append using _Argentina_neighbors.dta
{txt}
{com}. append using _Armenia_neighbors.dta
{txt}
{com}. append using _Australia_neighbors.dta
{txt}
{com}. append using _Austria_neighbors.dta
{txt}
{com}. append using _Azerbaijan_neighbors.dta
{txt}
{com}. append using _Bangladesh_neighbors.dta
{txt}
{com}. append using _Belarus_neighbors.dta
{txt}
{com}. append using _Belgium_neighbors.dta
{txt}
{com}. append using _Bhutan_neighbors.dta
{txt}
{com}. append using _Bolivia_neighbors.dta
{txt}
{com}. append using _Bosnia_and_Herzegovina_neighbors.dta
{txt}
{com}. append using _Brazil_neighbors.dta
{txt}
{com}. append using _Bulgaria_neighbors.dta
{txt}
{com}. append using _Burundi_neighbors.dta
{txt}
{com}. append using _Cambodia_neighbors.dta
{txt}
{com}. append using _Canada_neighbors.dta
{txt}
{com}. append using _Chad_neighbors.dta
{txt}
{com}. append using _Chile_neighbors.dta
{txt}
{com}. append using _China_neighbors.dta
{txt}
{com}. append using _Colombia_neighbors.dta
{txt}
{com}. append using _Congo_neighbors.dta
{txt}
{com}. append using _Costa_Rica_neighbors.dta
{txt}
{com}. append using _Croatia_neighbors.dta
{txt}
{com}. append using _Cyprus_neighbors.dta
{txt}
{com}. append using _Czech_Republic_neighbors.dta
{txt}
{com}. append using _Democratic_Republic_Congo_neighbors.dta
{txt}
{com}. append using _Denmark_neighbors.dta
{txt}
{com}. append using _Dominican_Republic_neighbors.dta
{txt}
{com}. append using _Ecuador_neighbors.dta
{txt}
{com}. append using _Egypt_neighbors.dta
{txt}
{com}. append using _El_Salvador_neighbors.dta
{txt}
{com}. append using _Estonia_neighbors.dta
{txt}
{com}. append using _Ethiopia_neighbors.dta
{txt}
{com}. append using _Finland_neighbors.dta
{txt}
{com}. append using _France_neighbors.dta
{txt}
{com}. append using _Georgia_neighbors.dta
{txt}
{com}. append using _Germany_neighbors.dta
{txt}
{com}. append using _Greece_neighbors.dta
{txt}
{com}. append using _Guatemala_neighbors.dta
{txt}
{com}. append using _Guinea_neighbors.dta
{txt}
{com}. append using _Honduras_neighbors.dta
{txt}
{com}. append using _Hungary_neighbors.dta
{txt}
{com}. append using _India_neighbors.dta
{txt}
{com}. append using _Indonesia_neighbors.dta
{txt}
{com}. append using _Iran_neighbors.dta
{txt}
{com}. append using _Ireland_neighbors.dta
{txt}
{com}. append using _Israel_neighbors.dta
{txt}
{com}. append using _Italy_neighbors.dta
{txt}
{com}. append using _Ivory_Coast_neighbors.dta
{txt}
{com}. append using _Kazakhstan_neighbors.dta
{txt}
{com}. append using _Kenya_neighbors.dta
{txt}
{com}. append using _Latvia_neighbors.dta
{txt}
{com}. append using _Lebanon_neighbors.dta
{txt}
{com}. append using _Lesotho_neighbors.dta
{txt}
{com}. append using _Lithuania_neighbors.dta
{txt}
{com}. append using _Macedonia_neighbors.dta
{txt}
{com}. append using _Malaysia_neighbors.dta
{txt}
{com}. append using _Mali_neighbors.dta
{txt}
{com}. append using _Mexico_neighbors.dta
{txt}
{com}. append using _Moldova_neighbors.dta
{txt}
{com}. append using _Mongolia_neighbors.dta
{txt}
{com}. append using _Morocco_neighbors.dta
{txt}
{com}. append using _Myanmar_neighbors.dta
{txt}
{com}. append using _Namibia_neighbors.dta
{txt}
{com}. append using _Nepal_neighbors.dta
{txt}
{com}. append using _Netherlands_neighbors.dta
{txt}
{com}. append using _Nicaragua_neighbors.dta
{txt}
{com}. append using _Nigeria_neighbors.dta
{txt}
{com}. append using _Norway_neighbors.dta
{txt}
{com}. append using _Pakistan_neighbors.dta
{txt}
{com}. append using _Panama_neighbors.dta
{txt}
{com}. append using _Paraguay_neighbors.dta
{txt}
{com}. append using _Peru_neighbors.dta
{txt}
{com}. append using _Poland_neighbors.dta
{txt}
{com}. append using _Portugal_neighbors.dta
{txt}
{com}. append using _Romania_neighbors.dta
{txt}
{com}. append using _Russia_neighbors.dta
{txt}
{com}. append using _Rwanda_neighbors.dta
{txt}
{com}. append using _Senegal_neighbors.dta
{txt}
{com}. append using _Slovakia_neighbors.dta
{txt}
{com}. append using _Slovenia_neighbors.dta
{txt}
{com}. append using _South_Africa_neighbors.dta
{txt}
{com}. append using _South_Korea_neighbors.dta
{txt}
{com}. append using _Spain_neighbors.dta
{txt}
{com}. append using _Sweden_neighbors.dta
{txt}
{com}. append using _Switzerland_neighbors.dta
{txt}
{com}. append using _Tajikistan_neighbors.dta
{txt}
{com}. append using _Thailand_neighbors.dta
{txt}
{com}. append using _Tunisia_neighbors.dta
{txt}
{com}. append using _Turkey_neighbors.dta
{txt}
{com}. append using _Ukraine_neighbors.dta
{txt}
{com}. append using _United_Kingdom_neighbors.dta
{txt}
{com}. append using _United_States_of_America_neighbors.dta
{txt}
{com}. append using _Uruguay_neighbors.dta
{txt}
{com}. append using _Venezuela_neighbors.dta
{txt}
{com}. append using _Vietnam_neighbors.dta
{txt}
{com}. append using _Yemen_neighbors.dta
{txt}
{com}. append using _Zambia_neighbors.dta
{txt}
{com}. 
. sort country year
{txt}
{com}. 
. save "neighbors_at_war.dta", replace
{txt}file neighbors_at_war.dta saved

{com}. 
. ***********************************************************
. * Merge war_neighbor files with main data
. ***********************************************************
. 
. use "war_default_dataset_participants.dta", clear
{txt}
{com}. 
. merge 1:1 country year using "neighbors_at_war.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}             686
{txt}{col 9}from master{col 30}{res}             686{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}matched{col 30}{res}           9,800{txt}  (_merge==3)
{col 5}{hline 41}

{com}. 
. * Islands do not enter the previous dataset.
.         replace n_neighbors_at_war = 0 if _merge != 3
{txt}(686 real changes made)

{com}.         drop _merge
{txt}
{com}. 
. * Sudden-stop years
. gen freeze_4y = 0 
{txt}
{com}. replace freeze_4y = 1 if year >=1825 & year<=1829
{txt}(535 real changes made)

{com}. replace freeze_4y = 1 if year >=1837 & year<= 1844
{txt}(856 real changes made)

{com}. replace freeze_4y = 1 if year >=1847 & year<= 1854
{txt}(856 real changes made)

{com}. replace freeze_4y = 1 if year >=1857    & year<= 1861
{txt}(535 real changes made)

{com}. replace freeze_4y = 1 if year >=1865  & year<=1871
{txt}(749 real changes made)

{com}. replace freeze_4y = 1 if year >=1890 & year<= 1894
{txt}(535 real changes made)

{com}. 
. *** Add 1910, a stock market crisis
.         replace freeze_4y = 1 if year >=1910 & year<= 1914
{txt}(428 real changes made)

{com}. *** Add 1873 crisis, not considered in Reinhart and Rogoff. 
.         replace freeze_4y = 1 if year >=1873 & year<= 1877
{txt}(535 real changes made)

{com}. 
. * War while credit flows
. bysort cowcode: gen neig_war_and_flow_uk_4y = 0 if n_neighbors_at_war == 0
{txt}(2,022 missing values generated)

{com}. bysort cowcode: replace neig_war_and_flow_uk_4y = 1 if (n_neighbors_at_war > 0 & n_neighbors_at_war<10) & freeze_4y == 0
{txt}(821 real changes made)

{com}. bysort cowcode: egen total_neig_war_and_flow_uk_4y = total(neig_war_and_flow_uk_4y)
{txt}
{com}.         
. * War while credit stops
. bysort cowcode: gen neig_war_and_stop_uk_4y = 0 if n_neighbors_at_war == 0
{txt}(2,022 missing values generated)

{com}. bysort cowcode: replace neig_war_and_stop_uk_4y = 1 if (n_neighbors_at_war > 0 & n_neighbors_at_war<10) & freeze_4y == 1
{txt}(809 real changes made)

{com}. bysort cowcode: egen total_neig_war_and_stop_uk_4y = total(neig_war_and_stop_uk_4y)
{txt}
{com}. 
. 
. ***********************************************************
. * Merge Sudden-stop + War Neighbor Data with Controls
. ***********************************************************
. 
. bysort cowcode: gen count = _n
{txt}
{com}. keep if count == 1
{txt}(10,379 observations deleted)

{com}. 
. keep country cowcode total_neig_war_and_stop_uk_4y total_neig_war_and_flow_uk_4y
{txt}
{com}. 
. merge 1:1 cowcode using "all_controls.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0
{txt}{col 5}matched{col 30}{res}             107{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. 
. save "data_for_analysis_reduced_form.dta", replace
{txt}file data_for_analysis_reduced_form.dta saved

{com}. 
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}/Users/Didac/Dropbox/Shared/Replication Files/IO_Replication/Data_building_part_2_print.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}22 May 2019, 11:49:40
{txt}{.-}
{smcl}
{txt}{sf}{ul off}